class TreeNode{
    constructor(val){
        this.val=val;
        this.left=null;
        this.right=null;
    }
}
function findPath(root,target){
    const result=[];
    function dfs(node,path){
        if(node===null){
            return
        }
        path.push(node.val);
        if(node.val===target){
            result.push([...path])
        }
        dfs(node.left,path)
        dfs(node.right,path);
        path.pop()
    }
    dfs(root,[])
    return result;
}